# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pgspecial
pkgname=('python2-pgspecial' 'python-pgspecial')
_pkgname=pgspecial
pkgver=2.2.1
pkgrel=1
pkgdesc='Meta-commands handler for Postgres Database.'
arch=('any')
url='https://pypi.org/project/pgspecial/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('46d45bb92601493359c07b679b12f79c7a4289140805fa1da92736fd01dd4bfec6699e67bcf6a52d2a22d171585084679804b49fe601d5d6675a28c4273df547')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pgspecial() {
  depends=('python2' 'python2-click' 'python2-sqlparse')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-pgspecial() {
  depends=('python' 'python-click' 'python-sqlparse')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

